<?php

class Zend_View_Helper_DisplayBox extends Zend_View_Helper_Abstract {

    protected $options = array(
        'class' => 'box-item',
        'id' => 'box-container',
        'disTitle' => true,
        'disShort' => true,
        'disBody' => true,
        'titleTag' => 'h2',
        'items' => array(),
    );

    public function displayBox($options = array()) {

        $options = array_merge($this->options, $options);
        $r = '';
        $options['items'] = (array) $options['items'];

        foreach ($options['items'] as $key => $item) {

            $r .= '<div id="' . $options['id'] . '-' . $item['id'] . '" class="' . $options['class'] . '">';

            $r .= '' . ($options['disTitle'] ? '<' . $options['titleTag'] . '>' . $item['title'] . '</' . $options['titleTag'] . '>' : '') .
                    '' . ($options['disShort'] ? '<div>' . $item['short'] . '</div>' : '') .
                    ($options['disBody'] ? '<div>' . $item['body'] . '</div>' : '');

            $r .= '<div class="cls"></div>
            </div>';
        }
        return $r;
    }

}